export default function (el) {
	let startX;
	let btn = el.getElementsByClassName('cart-list-item-btn')[0];
	el.style.transition = 'transform .5s';
	let moveWidth = btn.offsetWidth;
	el.addEventListener('touchstart', function (e) {
		startX = e.touches[0].clientX;
	});
	el.addEventListener('touchend', function (e) {
		let endX = e.changedTouches[0].clientX;
		let moveX = endX - startX;
		if (Math.abs(moveX) <= 50) return;
		if (moveX > 0) {
			el.style.transform = `translate3d(0px, 0, 0)`;
		} else {
			el.style.transform = `translate3d(-${moveWidth}px, 0, 0)`;
		}
	})
}
